﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Index</title>
    <style type="text/css">
    html { 
        overflow-y: scroll; /* 1 */
        -webkit-text-size-adjust: 100%; /* 2 */
        -ms-text-size-adjust: 100%;
    }        
    body
    {
        border-top:8px solid Pink;
        padding:0;
        margin:0;
        text-align:center;
    }
    #wrapper
    {
        width:400px;
        margin:0 auto;
        /*text-align:left;*/
        padding-top:100px;
    }
    </style>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {

            $('#uiTextarea').keyup(function (event) {
                if (event.keyCode == '32') {

                /*
                    var samplePersonObject = {
                        firstname: "Juri",
                        surname: "Strumpflohner",
                        address: {
                            street: "Via ....",
                            cap: "39100",
                            city: "Bolzano (BZ)"
                        }
                    };
                    var jsonSerialized = JSON.stringify(samplePersonObject);
                    console.log(jsonSerialized);*/


                    var json = { "text": $('#uiTextarea').val() };

                    console.log(json);
                    $.ajax({
                        url: '/Text/GetResult',
                        type: 'POST',
                        //dataType: 'json',
                        data: json,
                        //contentType: 'application/json; charset=utf-8',
                        success: function (data) {
                            $("#result").html(data.response);
                        }
                    });
                }
            });

        });
    </script>
</head>
<body>
    <div id="wrapper">
        <textarea id="uiTextarea" cols="30" rows="6">skriv en tekst...</textarea>
        <div id="result"></div>
    </div>
</body>
</html>